package wdt_qf.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import wdt_qf.entity.wdt.WdtHttpResult;
import wdt_qf.entity.wdt.WdtResponseJson;
import wdt_qf.service.WdtService;

import javax.annotation.Resource;

@RestController
@RequestMapping("uploadBillToWdt")
@Api(tags = "单据")
@Slf4j
public class UploadBillToWdtController {
    @Resource
    private WdtService wdtService;

    @GetMapping("/wdtService")
    @ApiOperation(value = "上传采购入库单到旺店通", response = WdtHttpResult.class)
    public WdtResponseJson uploadBuyBillToWdt(String billCode) {
        return wdtService.uploadBuyToWdt(billCode);
    }

    @GetMapping("/wdtOrderBuyService")
    @ApiOperation(value = "上传采购入订单到旺店通", response = WdtHttpResult.class)
    public WdtResponseJson wdtOrderBuyService(String billCode) {
        return wdtService.uploadOrderBuyToWdt(billCode);
    }

    @GetMapping("/wdtBuyBackOrderService")
    @ApiOperation(value = "上传采购退货订单到旺店通", response = WdtHttpResult.class)
    public WdtResponseJson wdtBuyBackOrderService(String billCode) {
        return wdtService.uploadCGTHToWdt(billCode);
    }

    @GetMapping("/wdtBuyBackService")
    @ApiOperation(value = "上传采购退货出库单到旺店通", response = WdtHttpResult.class)
    public WdtResponseJson wdtBuyBackService(String billCode) {
        return wdtService.uploadCGTHCKToWdt(billCode, "");
    }
}
